<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ taglib prefix="tags" tagdir="/WEB-INF/tags"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<c:if test="${includeBody}">
<head>
    <title><fmt:message key="coupon" /></title>
</head>
<body>
</c:if>
    <div id="couponSearchResultFragment">
        <h1><fmt:message key="coupon" /></h1>
        <script type="text/javascript">
            dojo.addOnLoad(function() {
                dojo.query(".couponAjaxSearch").forEach(function(element) {
                    Spring.addDecoration(new Spring.AjaxEventDecoration({
                        elementId: element.id,
                        event: "onclick",
                        params: { decorator: "none" }
                    }));
                })

                dojo.query(".couponAjaxDelete").forEach(function(element) {
                    Spring.addDecoration(new Spring.AjaxEventDecoration({
                        elementId: element.id,
                        event: "onclick",
                        popup: "true",
                        params: { decorator: "none" }
                    }));
                })
				dojo.query("a.ajaxPagerLink").forEach(function(element) {
					Spring.addDecoration(new Spring.AjaxEventDecoration({
						elementId: element.id,
						event: "onclick",
						params: { decorator: "none" }
					}));
				})
            });
        </script>
        <c:url var="searchUrl" value="/domain/coupon/searchAjax.action"/>
        <table class="listEntities">
            <thead>
                <tr>
                    <th scope="col">&nbsp;</th>
                    <th scope="col">
                        <a id="sortLinkcouponId" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.couponIdQueryStringForSortableHeader}">
                            <fmt:message key="coupon_couponId"/>&nbsp;${couponSearchForm.couponIdSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkcreationBy" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.creationByQueryStringForSortableHeader}">
                            <fmt:message key="coupon_creationBy"/>&nbsp;${couponSearchForm.creationBySortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkcreationDate" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.creationDateQueryStringForSortableHeader}">
                            <fmt:message key="coupon_creationDate"/>&nbsp;${couponSearchForm.creationDateSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkdescription" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.descriptionQueryStringForSortableHeader}">
                            <fmt:message key="coupon_description"/>&nbsp;${couponSearchForm.descriptionSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkdisplayName" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.displayNameQueryStringForSortableHeader}">
                            <fmt:message key="coupon_displayName"/>&nbsp;${couponSearchForm.displayNameSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkenabled" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.enabledQueryStringForSortableHeader}">
                            <fmt:message key="coupon_enabled"/>&nbsp;${couponSearchForm.enabledSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkendDate" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.endDateQueryStringForSortableHeader}">
                            <fmt:message key="coupon_endDate"/>&nbsp;${couponSearchForm.endDateSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkpromotionType" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.promotionTypeQueryStringForSortableHeader}">
                            <fmt:message key="coupon_promotionType"/>&nbsp;${couponSearchForm.promotionTypeSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkrelExpiration" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.relExpirationQueryStringForSortableHeader}">
                            <fmt:message key="coupon_relExpiration"/>&nbsp;${couponSearchForm.relExpirationSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkstartDate" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.startDateQueryStringForSortableHeader}">
                            <fmt:message key="coupon_startDate"/>&nbsp;${couponSearchForm.startDateSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinktimeUntilExpire" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.timeUntilExpireQueryStringForSortableHeader}">
                            <fmt:message key="coupon_timeUntilExpire"/>&nbsp;${couponSearchForm.timeUntilExpireSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinktype" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.typeQueryStringForSortableHeader}">
                            <fmt:message key="coupon_type"/>&nbsp;${couponSearchForm.typeSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkuses" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.usesQueryStringForSortableHeader}">
                            <fmt:message key="coupon_uses"/>&nbsp;${couponSearchForm.usesSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkbusinessUnitId" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.businessUnitIdQueryStringForSortableHeader}">
                            <fmt:message key="coupon_businessUnitId"/>&nbsp;${couponSearchForm.businessUnitIdSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">
                        <a id="sortLinkdefaultMedia" class="couponAjaxSearch" href="${searchUrl}?${couponSearchForm.defaultMediaQueryStringForSortableHeader}">
                            <fmt:message key="coupon_defaultMedia"/>&nbsp;${couponSearchForm.defaultMediaSortStatusEntity}
                        </a>
                    </th>
                    <th scope="col">&nbsp;</th>
                </tr>
            </thead>
            <tbody>
            <c:forEach items="${coupons}" var="coupon" varStatus="status">
                <tr>
                    <td>
						<c:choose>
							<c:when test="${coupon.status != 2}">
    							<input type="checkbox" name="originalId" value="${coupon.couponId}" />
							</c:when>
						</c:choose> 
                    </td>
                    <td>
                        <c:out value="${coupon.couponId}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.allowMultiple}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.anonProfile}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.approval}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.creationBy}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.creationDate}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.description}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.displayName}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.enabled}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.endDate}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.promotionType}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.relExpiration}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.startDate}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.timeUntilExpire}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.type}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.uses}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.businessUnitId}"/>
                    </td>
                    <td>
                        <c:out value="${coupon.defaultMedia}"/>
                    </td>
                    <td>
                        <c:url var="showUrl" value="/domain/coupon/show.action">
                            <c:param name="coupon.couponId" value="${coupon.couponId}"/>
                        </c:url>
                        <c:url var="updateUrl" value="/domain/coupon/updateForm.action">
                            <c:param name="coupon.couponId" value="${coupon.couponId}"/>
                        </c:url>
                        <c:url var="confirmDeleteUrl" value="/domain/coupon/confirmDelete.action">
                            <c:param name="coupon.couponId" value="${coupon.couponId}"/>
                        </c:url>
                        <a class="actionShow" href="${showUrl}"><fmt:message key="label.link.show"/></a>
                        <a class="actionUpdate" href="${updateUrl}"><fmt:message key="label.link.update"/></a>
                        <a class="actionDelete couponAjaxDelete" id="confirmDeleteUrl${status.index}" href="${confirmDeleteUrl}"><fmt:message key="label.link.delete"/></a>
                    </td>
                </tr>

            </c:forEach>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="23">
                        <p>
                            <tags:navigation pager="${pagerDisplay}" url="${searchUrl}" form="${couponSearchForm}"/>
                        </p>
                    </td>
                </tr>
            </tfoot>
        </table>
    </div>
<c:if test="${includeBody}">
</body>
</c:if>